import Vue from 'vue'
import Router from 'vue-router'
import Msite from '../pages/Msite/Msite.vue'
import Order from '../pages/Order/Order.vue'
import Profile from '../pages/Profile/Profile.vue'
import Search from '../pages/Search/Search.vue'
import Login from '../pages/login/login.vue'

import  Shop from '../pages/Shop/Shop'

import  ShopGoods from '../pages/Shop/ShopGoods/ShopGoods'
import  ShopInfo from '../pages/Shop/ShopGoods/ShopInfo'
import  ShopRatings from '../pages/Shop/ShopGoods/ShopRatings'

// meta: { requiresAuth: true }    
//1 登录验证控制
//2 权限控制
Vue.use(Router)
export default new Router({
  linkActiveClass:'on', // 被选中的路由对应的标签上面会有一个类名叫on
  mode:'history',
  routes: [

    {path:'/',redirect:'/msite'},
    {
      path:'/msite',
      name:'msite',
      component:Msite,
      meta: { requiresAuth: true }  
    },
    {
      path:'/search',
      name:'search',
      component:Search,
      meta: { requiresAuth: true }
    },
    {
      path:'/order',
      name:'order',
      component:Order,
      meta: { requiresAuth: true }
    },
    {
      path:'/profile',
      name:'profile',
      component:Profile,
      meta: { requiresAuth: true }
    },
    {
      path:'/login',
      name:' login',
      component: Login
    },
    {
      path:'/shop',
      name:' shop',
      component: Shop,
      children:[
        {
          path:'/shop/goods',
          component:ShopGoods
        },
        {
          path:'/shop/ratings',
          component:ShopRatings
        },
        {
          path:'/shop/info',
          component:ShopInfo
        },
        {
          path:'',
          redirect:'/shop/goods'
        }
      ]
    }



   
  ]
})